/*
 * EindeSpel.java
 *
 * Created on 19 mei 2008, 11:38
 */

package be.hogent.iii.project.gui;

import java.io.File;
import javax.imageio.ImageIO;
import javax.swing.ImageIcon;

/**
 *
 * @author  Anquilas
 */
public class EindeSpel extends javax.swing.JFrame {
    private boolean gewonnen;
        
    /** Creates new form EindeSpel */
    public EindeSpel(boolean gewonnen) {
        initComponents();
        this.gewonnen = gewonnen;
        bepaalWeergave();
        this.setLocationRelativeTo(null);
        this.setVisible(true);
    }
    
    /**
     * Zal bepalen wat er moet worden weergegeven, naargelang of deze persoon verloren of gewonnen is
     * */
    public void bepaalWeergave() {
        String tekst, titel;
        File bestand;

        if(gewonnen) {
            tekst = "U heeft gewonnen - Proficiat!";
            bestand = new File("src\\be\\hogent\\iii\\project\\gui\\images\\Victory.jpg");
            titel = "Proficiat!";
        }
        else {
            tekst = "U heeft verloren - volgende keer beter";
            bestand = new File("src\\be\\hogent\\iii\\project\\gui\\images\\defeat.jpg");    
            titel = "Spijtig!";
        }
        
        labelWin.setText(tekst);
        this.setTitle(titel);
        try {
            labelWin.setIcon(new ImageIcon(ImageIO.read(bestand)));
        }
        catch(Exception ex) {
            System.out.println("Geen icoon: " + ex.getMessage());
            //dan geen icoon, nah
        }
    }
    

    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        labelWin = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

        jPanel1.setBackground(new java.awt.Color(0, 0, 0));

        labelWin.setFont(new java.awt.Font("Tahoma", 1, 12));
        labelWin.setForeground(new java.awt.Color(255, 153, 0));
        labelWin.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(labelWin, javax.swing.GroupLayout.DEFAULT_SIZE, 396, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(labelWin, javax.swing.GroupLayout.PREFERRED_SIZE, 104, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents
    

    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JPanel jPanel1;
    private javax.swing.JLabel labelWin;
    // End of variables declaration//GEN-END:variables
    
}
